/*
 * @Author: Qimu
 * @Date: 2020-04-22 15:55:22
 * @LastEditors: Qimu
 * @LastEditTime: 2020-04-22 21:23:00
 * @Description: file content
 * @FilePath: \koa2_api\module\schama\carousel.js
 */

const mongoose = require('../db/mongodb');
const config = require('../config/config');

const carouselSchema = mongoose.Schema({
  carousel_name: { //课程轮播图片名称
    type: String,
    require: true,
    trim: true
  },
  carousel_img: {  //课程轮播图片
    type: String,
    require: true,
  },
  carousel_url: {  //轮播图片链接
    type: String,
    require: true,
  },
  carousel_status: {  //是否显示轮播
    type: Number,
    default: 1
  },
  carousel_createTime: { //课程创建时间
    type: Date,
    default: Date.now
  },
  carousel_updateTime: { //课程更新时间
    type: Date,
    default: Date.now
  }
}, {
  timestamps: {
    createdAt: 'carousel_createTime',
    updatedAt: 'carousel_updateTime'
  }
})

module.exports = Carousel = mongoose.model('Carousel', carouselSchema, `${config.mongodb.table}carousel`);